<!doctype html>
<html>

	<head>
		<meta http-equiv="Access-Control-Allow-Origin" content="">

		<meta http-equiv="content-security-policy">
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link rel="stylesheet" href="css/mui.min.css">
		
		<style>
			.mui-table-view-cell{
				flex-flow: column;
			}
			.mui-bar-nav{
				margin-bottom: 0;
			}
			.mui-table-view-cell{
				margin-top: 10px;
				vertical-align: middle;
			}
			.left-icon{
				margin: 0 10px 0 5px;
				width: 18px;
			}
			.text-list{
				font-size: 14px;
				display: inline-block;
			}
			
		</style>
	</head>

	<body>
		<div class="mui-inner-wrap">
		<header class="mui-bar mui-bar-nav">
					<a  class="mui-action-back mui-icon mui-icon-back mui-pull-left"></a>
					<h1 class="mui-title">我的账号</h1>
				</header>
		</div>
		<div style="margin-bottom: 10px;"  align="center">
			<img src="img/head_portrait.png" style="margin:0 10px 0 10px;"/>
		</div>
		<div id="id" style="display:none;" ></div>
		<ul class="mui-table-view">
			<li class="mui-table-view-cell" id="nicknamexx">昵称
					<span id="nickname" class="mui-badge"></span>
			</li>
			<li class="mui-table-view-cell" id="sexxx">性别
					<span id="sex" class="mui-badge"></span>
			</li>
			<li class="mui-table-view-cell" id="emailxx">邮箱
					<span id="email" class="mui-badge"></span>
			</li>
			<li class="mui-table-view-cell" id="address">地区
					<span id="ssq" class="mui-badge"></span>
			</li>
			<li class="mui-table-view-cell" id="signaturexx">个人简介
					<span id="signature" class="mui-badge"></span>
			</li>
		</ul>
		<ul class="mui-table-view" style="margin-top: 25px;">
			<li class="mui-table-view-cell">
				<a id="readpassword"  style="text-align: center;color: #FF3B30;">
					设置阅读密码
				</a>
				
			</li>
			<li class="mui-table-view-cell">
				<a id="cxlogin" style="text-align: center;color: #FF3B30;">
					退出登录
				</a>
			</li>
		</ul>
		<script src="js/mui.min.js"></script>
		<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>
		<script src="js/update.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
		var myUrl1;
		window.addEventListener('refresh', function(e) {
				location.reload();
			});
		
		
		function plusReady(){
            // 在这里调用plus api
            	var token=plus.storage.getItem('accessToken');
            	myUrl1=plus.storage.getItem("myUrl1");
            	alert(token);
		         document.getElementById('id').innerText=token;
		         mui.ajax(myUrl1+'/note-user/user/getUser',{
				data:{
					token:$("#id").text(),
					id:$("#id").text()
				},
				dataType:'json',//服务器返回json格式数据 
				crossDomain: true,
				type:'post',//HTTP请求类型
				success:function(data){
					var address=data.province+data.city+data.region;
					document.getElementById('nickname').innerText=data.nickname;
					document.getElementById('sex').innerText=data.sex;
					document.getElementById('email').innerText=data.email;
					document.getElementById('ssq').innerText=address;
					document.getElementById('signature').innerText=data.signature;
				} 
			});
        }
        if(window.plus){
            plusReady();
        }else{
            document.addEventListener('plusready',plusReady,false);
        }	
		mui.init({
		                beforeback: function() {
		                var list = plus.webview.currentWebview().opener();
		                    //触发列表界面的自定义事件（refresh）,从而进行数据刷新   
		                    mui.fire(list, 'refresh');
		                    //返回true，继续页面关闭逻辑   
		                    return true;
		                }
		                
		                
		            })
		
		 document.getElementById("address").addEventListener("click", function() {
                 mui.openWindow({
                      url: "address.html",
                      id: "address",
                       show: {
                        aniShow: 'pop-in'
                    },
                     waiting: {
                         autoShow: false
                     },
                      extras:{
                       ids:$("#id").text()
                     }
                 });
             
            });
            
            
            
            document.getElementById("nicknamexx").addEventListener("click", function() {
                 mui.openWindow({
                      url: "nickname.html",
                      id: "nickname",
                       show: {
                        aniShow: 'pop-in'
                    },
                     waiting: {
                         autoShow: false
                     },
                      extras:{
                      	ids:$("#id").text(),
                       nickname:document.getElementById('nickname').innerText
                     }
                 });
             
            });
            
		
			document.getElementById("sexxx").addEventListener("click", function() {
                 mui.openWindow({
                      url: "sex.html",
                      id: "sex",
                       show: {
                        aniShow: 'pop-in'
                    },
                     waiting: {
                         autoShow: false
                     },
                      extras:{
                      	ids:$("#id").text(),
                       sex:document.getElementById('sex').innerText
                     }
                 });
             
            });		
		
		
			document.getElementById("emailxx").addEventListener("click", function() {
                 mui.openWindow({
                      url: "email.html",
                      id: "email",
                       show: {
                        aniShow: 'pop-in'
                    },
                     waiting: {
                         autoShow: false
                     },
                      extras:{
                      	ids:$("#id").text(),
                       email:document.getElementById('email').innerText
                     }
                 });
             
            });	
		
			document.getElementById("readpassword").addEventListener("click", function() {
                 mui.openWindow({
                      url: "readpassword.html",
                      id: "readpassword",
                       show: {
                        aniShow: 'pop-in'
                    },
                     waiting: {
                         autoShow: false
                     },
                      extras:{
                      	ids:$("#id").text()
                     }
                 });
             
            });	
		
		
		
			document.getElementById("signaturexx").addEventListener("click", function() {
                 mui.openWindow({
                      url: "signature.html",
                      id: "signature",
                       show: {
                        aniShow: 'pop-in'
                    },
                     waiting: {
                         autoShow: false
                     },
                      extras:{
                      	ids:$("#id").text(),
                      	signature:document.getElementById('signature').innerText
                     }
                 });
             
            });	
            
            document.getElementById("cxlogin").addEventListener("click", function() {
                 mui.openWindow({
                      url: "index_login.html",
                      id: "index_login",
                       show: {
                        aniShow: 'pop-in'
                    },
                     waiting: {
                         autoShow: false
                     },
                      extras:{
                      	
                     }
                 });
             
            });	
            
            
		
		
		mui.plusReady(function() {    
			console.log("aa");
        
        });
		
		    
		
		

			 //侧滑容器父节点
			var offCanvasWrapper = mui('#offCanvasWrapper');
			
			 //主界面和侧滑菜单界面均支持区域滚动；
			mui('#offCanvasSideScroll').scroll();
			mui('#offCanvasContentScroll').scroll()
			
		/*		//个人信息头像的点击事件
		$("body").on('click','#personimg',function(){
			person();
		})
		*/
		/*$("body").on('click','#address',function(){
			
			address();
		})*/
		//跳转个人信息详细界面
		/*function person(){
			mui.openWindow({
				url: 'personxx.html'
			})
		}*/
		
		//跳转地址信息详细界面
		/*function address(){
			mui.openWindow({
				url: 'address.html'
			})
		}*/
			
		/* var xhr = new plus.net.XMLHttpRequest();  
            xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');  
            xhr.onreadystatechange = this.onReadStatechange();  
            if ((typeof authorizationHeader != 'undefined') && (authorizationHeader != '')) {  
                xhr.setRequestHeader(DigestAuthentication.AUTHORIZATION_HEADER, authorizationHeader);  
                $.each(headers, function(index, value) {  
                    xhr.setRequestHeader(value.headerName, value.headerValue);  
                });  
            }  
            xhr.open(DigestAuthentication.HTTP_METHOD, uri);  
            xhr.send(body); */
           
	    
		
		
		
			
	            /*mui.ajax({
	                type: "get",
	                url: "http://192.168.7.30:9094/user/getuser/?jsoncallback=?",
	                async: true,
	                data: {
	                    id: 2
	                    
	                },
	                dataType: "jsonp",
	                jsonp: "jsoncallback",
	                timeout: 1000,
	                success: function(data) {
	                    alert(data);
	                    var vData = JSON.stringify(data);
	                    alert(vData);
	                },
	                error: function(xhr, type, errorThrown) {
	                    plus.nativeUI.toast(errorThrown);
	                }
	            });*/
        	
		    
		
		</script>
		
	</body>

</html>
